<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>日志管理</title>
	
   <jsp:include page="/pub.jsp"></jsp:include>
</head>
<body>
 
     <div style="height: 70px; width: 100%;">
    	<form id="searchForm45f" method="post" action="<%=basePath %>log/list">  
    <div style="float: left; padding:20px 0 0 20px; ">   
        <label for="name">用户名:</label>   
        <input class="easyui-validatebox" type="text" name="username"  />   
    </div>   
    <div style="float: left;padding:20px 0 0 20px;">   
        <label for="ic">描述:</label>   
        <input  type="text" name="describe" class="easyui-textbox" />   
    </div>  
  	
    <div style="float: left;padding:20px 0 0 20px;">
    <select id="type" class="easyui-combobox" name="type" style="width:100px;height=:100px"> 
    <option value="0">请求</option>   
    <option value="1">异常</option>   
    <option value="99">全部</option>   
	</select> 
	</div> 

      <div style="float: left;padding:20px 0 0 20px;">   
          <a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-search" onclick="log_searchFun();">查询</a>
          <a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-clear" onclick="log_clearFun();">清空</a>
    </div> 
	</form>  
</div> 


    	
    
    <table id="dg13e"  class="easyui-datagrid" style="height: 470px;"
            url="<%=basePath %>log/list"
            toolbar="#toolbar1" pagination="true"
            rownumbers="true" fitColumns="true" singleSelect="true"
            data-options="fit:false,border:false,pageSize:15,pageList:[5,10,15,20]" >
            	
            
        <thead>
            <tr>
            	
                <th field="username" width="30">姓名</th>
                <th field="describe" width="50">描述</th>
                <th field="method" width="50">请求方法</th>
                <th field="params" width="50">请求参数</th>
                <th field="exceptioncode" width="50">异常代码</th>
                <th field="type" width="30" formatter="showType">类别</th>
                <th field="exceptiondetail" width="50" >异常信息</th>
               
                <th field="ip" width="50" >ip</th>
                <th field="createtime" width="50" formatter="showTime">操作时间</th>
                
            </tr>
        </thead>
    </table>
    <div id="toolbar1">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="viewLog()">详情</a>
    </div>
    
    <div id="dlg" class="easyui-dialog"  style="padding:10px 20px"
            closed="true" buttons="#dlg-buttons">
        <div class="ftitle">详细信息</div>
        <form id="fm" method="post" novalidate>
            <div class="fitem">
                <label>姓名:</label>
                <input name="username" class="easyui-textbox" required="true">
            </div>
            <div class="fitem">
                <label>描述:</label>
                <input name="describe" class="easyui-textbox" required="true">
            </div>
            <div class="fitem">
                <label>请求方法:</label>
                <input name="method" class="easyui-textbox">
            </div>
             <div class="fitem">
                <label>请求参数:</label>
                <input name="params" class="easyui-textbox" >
            </div>
            <div class="fitem">
                <label>异常代码:</label>
                <input name="exceptioncode" class="easyui-textbox" validType="email">
            </div>
            
            <div class="fitem">
                <label>类别:</label>
                <input name="type" class="easyui-textbox" >
            </div>
            <div class="fitem">
                <label>异常明细:</label>
                <input name="exceptiondetail" class="easyui-textbox" >
            </div>
            <div class="fitem">
                <label>ip:</label>
                <input name="ip" class="easyui-textbox" >
            </div>
           
             <div class="fitem">
                <label>操作时间:</label>
                <input name="createtime" class="easyui-textbox" >
            </div>
        </form>
    </div>
    <div id="dlg-buttons">
        <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveUser()" style="width:90px">保存</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">取消</a>
    </div>
    <script type="text/javascript">
        var url;
      
        function viewLog(){
            var row = $('#dg13e').datagrid('getSelected');
            /* if (row){
                $('#dlg').dialog('open').dialog('setTitle','详情');
                $('#fm').form('load',row);
                url = 'admin/getOneById/'+row.id;
            } */
            if(row !=undefined){
        		var dialog = parent.modalDialog({
        			title : '查看详情',
        			width : 750,
        			height : 500,
        			url : '${pageContext.request.contextPath}/log/view'+"/"+row.id
        		});
        	//window.open('${pageContext.request.contextPath}/expense/listAccachment'+"/"+rows[0].id);
        	}else{
        		parent.$.messager.alert('提示','请选择一条记录进行查看');
        	}
        }
       
     
       
        function log_searchFun() {
        	$('#dg13e').datagrid('load', serializeObject($('#searchForm45f')));
        }
        function log_clearFun() {
        	$('#searchForm45f input').val('');
        }
        
        function showType(val,row){
    		if (val == 1){
    			return '异常';
    		} else {
    			return "请求";
    		}
    	}
       
        
         function showTime (value,row){
			if(value!=undefined){
				return getFormatDateByLong(value*1000,"yyyy-MM-dd hh:mm:ss");
				//return getFormatDateByLong(value,"yyyy-MM-dd hh");
			}
		} 
       
    </script>
    <style type="text/css">
        #fm{
            margin:0;
            padding:10px 30px;
        }
        .ftitle{
            font-size:14px;
            font-weight:bold;
            padding:5px 0;
            margin-bottom:10px;
            border-bottom:1px solid #ccc;
        }
        .fitem{
            margin-bottom:5px;
        }
        .fitem label{
            display:inline-block;
            width:80px;
        }
        .fitem input{
            width:160px;
        }
    </style>
    <!--  
    <div id="dlg2" class="easyui-dialog" title="Toolbar and Buttons" style="width:400px;height:200px;padding:10px"
			data-options="
				
				buttons: [{
					text:'Ok',
					iconCls:'icon-ok',
					handler:function(val,row){
						alert(row);
					}
				},{
					text:'Cancel',
					handler:function(){
						alert('cancel');;
					}
				}]
			">
		The dialog content.
	</div>
	-->
</body>
</html>